<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>用户登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="DeathGhost" />
    <link rel="stylesheet" type="text/css" href="../public/css/particleStyle.css" />
    <link rel="stylesheet" type="text/css" href="../public/css/fishing.css" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
    <script src="../public/js/jquery-1.11.1.min.js"></script>
    <script src="../public/js/Particleground.js"></script>
    <link rel="stylesheet" href="../public/layui/css/layui.css">
	<script src="../public/layui/layui.all.js"></script>
    <script>
        $(document).ready(function () {
            //粒子背景特效
            $('body').particleground({
                dotColor: 'white',
                lineColor: 'white'
            });
        });
    </script>
</head>

<body class="loginBd">
    <form  id="dl">
        <dl class="admin_login">
            <dt>
                <strong>考试管理系统</strong>
                <em>Management System</em>
            </dt>

            <dd class="user_icon">
                <input name="name" type="text" placeholder="用户名" class="login_txtbx" />
            </dd>
            <dd class="pwd_icon">
                <input name="password" type="password" placeholder="密码" class="login_txtbx" />
                <span class="eyes">
                </span>

            </dd>
            <dd class="val_icon">
                <div class="checkcode">
                    <input name="verify" type="text" id="J_codetext" placeholder="输入验证码" maxlength="6"
                        class="login_txtbx">
                    <img src="../verify/verify.php" alt="captcha" onclick="this.src=this.src+'?'"
                        style="cursor: pointer;height: 42px;" />
                </div>
            </dd>
            <dd>
                <input type="submit" value="登 陆" class="submit_btn" />
            </dd>
            <dd>
                <p>© 2019 版权所有</p>
            </dd>
        </dl>
    </form>

</body>
<script type="text/javascript">
    $('.eyes').click(function () {
        /*密码s是否可视*/
        $(this).find('img').fadeToggle();
        if ($(this).prev('input').attr('type') == 'text') {
            $(this).prev('input').attr('type', 'password');
        } else {
            $(this).prev('input').attr('type', 'text');
        }
    });
    $('#dl').on('submit', function (event) {
        event.preventDefault();
        if (!$(this).serializeArray()[0].value) {
            layer.msg('用户名不能为空!', { icon: 5, time: 1000, offset: '550px', anim: 6 });
            return;
        }
        if (!$(this).serializeArray()[1].value) {
            layer.msg('密码不能为空!', { icon: 5, time: 1000, offset: '550px', anim: 6 });
            return;
        }
        if (!$(this).serializeArray()[2].value) {
            layer.msg('验证码不能为空!', { icon: 5, time: 1000, offset: '550px', anim: 6 });
            return;
        }
        var ii = layer.load(1);
        $.ajax({
            type: "post",
            url: "comm/login.php",
            data: $(this).serializeArray(),
            success: function (res) {
                res = JSON.parse(res);
                if (res.code == 200) {
                		location.href="/study/style/check_url.php?url=admin/mainshow.php"
                		layer.close(ii);
                } else {
                	layer.msg('登录失败，请重新输入信息!', { icon: 5, time: 1000 });
                }
                layer.close(ii);
            },
            error: function (err) {
                layer.msg('程序异常!', { icon: 5, time: 1000 });
            }
        });
    });
</script>

</html>